import axios from "axios";

const bmi = {
  state: {
    count: 999,
    msg: "hello bmi module",
    list: [],
  },
  mutations: {
    SET_LIST(state, data) {
      state.list = data;
    },
  },
  actions: {
    async getList({ commit }) {
      const res = await axios({ url: "https://veihwwnelcwq.leanapp.cn/bmi" });
      // console.log(res.data.data)
      commit("SET_LIST", res.data.data);
    },
  },
  getters: {
    // countX10: (state) => state.count * 10,
    count123: (state) => {
      // console.log(getters)
      // console.log(rootState)
      return state.count * 123;
    },
    msg2: (state) => state.msg.repeat(2),
  },
  namespaced: true,
};

export default bmi;
